package it.gma.torero.operator;

import it.gma.torero.expression.BooleanExpression;
import it.gma.torero.operand.VariableBinder;


public class EquivalentOperator extends AbstractBooleanOperator {

	

	private NotOperator equivalent;

	public EquivalentOperator(BooleanExpression operand1, BooleanExpression operand2) {
		super(operand1, operand2);
		equivalent = new XorOperator(operand1, operand2).not();
	}

	public boolean evaluate() {
		return equivalent.evaluate();
	}

	@Override
	public String toString() {
		return "(" + operand1 + " <=> " + operand2 + ")";
	}

	@Override
	public void setContext(VariableBinder context) {
		super.setContext(context);
		equivalent.setContext(context);
	}
	
}
